package com.yanqu.road.server.manager.union.listener;

import com.yanqu.road.entity.enums.eUnionSyncType;
import com.yanqu.road.entity.union.cross.CrossUnionInfo;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.logic.cross.CrossGroupUnionValueRankListModel;
import com.yanqu.road.server.manager.union.honors.CrossUnionHonorsRankMgr;
import com.yanqu.road.server.manger.ICrossUnionSyncListener;
import com.yanqu.road.server.manger.ServerGroupMgr;

import java.util.List;

public class CrossUnionHonorsListener implements ICrossUnionSyncListener {

    @Override
    public void notifySync(int syncType, long playerId, CrossUnionInfo unionInfo, List<CrossUnionMember> memberList) {

        if(syncType == eUnionSyncType.DeleteUnion.getValue()){

            //清除榜单
            int groupId = ServerGroupMgr.getGroupIdByServerId(unionInfo.getServerId());
            CrossGroupUnionValueRankListModel listModel = CrossUnionHonorsRankMgr.getCrossGroupUnionRankListModel(groupId);
            if(listModel != null){
                listModel.removeRank(unionInfo.getUnionUid());
            }
        }

    }
}
